
from flask_restful import Resource, reqparse  # type: ignore
from core.roles.role_check import check_perms
from libs.login import login_required
from controllers.console import api
from services.robot.robot_remote_service import RobotRemoteService

class RobotAgentsApi(Resource):
    @login_required
    @check_perms(perms=['robot_agents:list'])
    def get(self):
        argparser = reqparse.RequestParser()
        argparser.add_argument("agent_type",type=str,choices=["RobotAgent","EmojiPredictAgent","TimbrePredictAgent"], required=True,location='args')
        args = argparser.parse_args()
        agent_tag = args["agent_type"]
        return RobotRemoteService.get_robot_agents(agent_tag)

api.add_resource(RobotAgentsApi,"/robots/agents")